// 重建二叉树，输入二叉树的前序和中序遍历的结果。重建出该二叉树。

#include "BinaryTree.h"

int main(int argc, char * argv[])
{
    int PreOrder[] = {1, 2, 4, 5, 3, 6, 7};
    int InOrder[] = {4, 2, 5, 1, 6, 3, 7};
    int Length = sizeof(PreOrder) / sizeof(int);

    BinaryTreeNode * pRoot = Construct(PreOrder, InOrder, Length);
    BinaryTreeNode * pNode = Construct(PreOrder, InOrder, Length);
    // ConnectTreeNodes(pRoot, pNode, pNode);
    PrintTree(pRoot);
    
    int preOrder[] = {3, 6, 8};
    int inOrder[] = {6, 3, 8};

    BinaryTreeNode * pSubRoot = Construct(preOrder, inOrder, 3);
    PrintTree(pSubRoot);

    cout << HasSubTree(pRoot, pSubRoot) << endl;


    MirrorBinaryTree_Recursively(pRoot);
    PrintTree(pRoot);
    DestroyTree(pRoot);
}
